package com.qfedu.wmsuser.user.controller;



import com.qfedu.common.core.annotation.NoLoginCheck;
import com.qfedu.common.core.common.R;
import com.qfedu.wmsuser.user.param.LoginParam;
import com.qfedu.wmsuser.user.param.LoginParam1;
import com.qfedu.wmsuser.user.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @author zhaos
 */
@CrossOrigin
@RestController
@RequestMapping("/user")
public class LoginController {

    private static final Logger log = LoggerFactory.getLogger(LoginController.class);
    @Resource
    private UserService userService;


    @NoLoginCheck
    @PostMapping("/login1")
    public R login(@RequestBody @Value("loginParam") LoginParam loginParam){
        Object token = userService.login(loginParam);
        log.info("token: {}", token);
        return R.ok("登录成功",token);
    }

    @NoLoginCheck
    @PostMapping("/login")
    public R login1(@RequestBody @Value("loginParam1") LoginParam1 loginParam1){
        Object token = userService.login1(loginParam1);
        log.info("token: {}", token);
        return R.ok("登录成功login1",token);
    }

}
